package cn.wh.beans;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;

/**
 * @author: wh
 * @create: 2022-08-31 08:51
 * @description
 **/

public class PropertyValues {
    private final List<PropertyValue> propertyValueList=new ArrayList<>();

    public void addPropertyValue(PropertyValue propertyValue){
        this.propertyValueList.add(propertyValue);
    }

    public PropertyValue[] getPropertyValues(){
        return propertyValueList.toArray(new PropertyValue[0]);
    }

    public PropertyValue getPropertyValue(String propertyName) {
        for (PropertyValue pv : this.propertyValueList) {
            if (pv.getName().equals(propertyName)) {
                return pv;
            }
        }
        return null;
    }

}
